import React, { Component } from 'react'
import './CssV'

export default class Controller extends Component {
    changeDate = (event)=>{
        const {target} = event
        const {name, suffix} = this.props
        console.log(target, target.value)
        
        document.documentElement.style.setProperty( `--${name}`, target.value +  (suffix || ""))

    }

  render() {
    const {name, type, defaultValue} = this.props
    return (
      <input 
        name={name} 
        type={type} 
        defaultValue={defaultValue}
        onChange={this.changeDate}
        />
    )
  }
}
